<template>
  <div class="sll">
    <!-- 修改组件 skipSign:true //跳过检验-->
    <el-tooltip class="item" effect="dark" content="修改" placement="bottom-start">
      <el-button style="color: #0b9ac3; border: none" icon="el-icon-edit" circle @click="modificationiClick">
      </el-button>
      <!-- @click="DialogVisibleMods = true" -->
    </el-tooltip>
    <el-dialog title="编辑" :visible.sync="DialogVisibleMods" width="760px" :before-close="handleCloses"
      :show-close="false" :modal-append-to-body="false" style="text-align: left" modal>
      <!-- :key="keyNumb" -->
      <div class="list" v-for="(item, index) in attributeOrderClone" :key="index" v-if="item.modificationSign">
        <!-- {{attributeOrderClone}} -->
        <!-- {{searchOption}}
          {{searchOptions}}-->
        <!-- {{fromModData}} -->
        <!-- {{modData}} -->
        <!-- {{optionsZi}} -->
        <!-- {{searchOptionTable}} -->
        <!-- <dictionaries :searchData='attributeOrder' :modelType='modelType'></dictionaries> -->
        <span class="fon">
          <span v-if="!item['skipSign'] && item['Exp'] != ''" style="color: red">*</span>
          {{ item.CN }}:
        </span>
        <span class="inb" v-if="item.type === 'input'">
          <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="fromModData[item.EN]"
            v-if="item.EN === 'notes' || item.EN === 'memo'"></el-input>
          <div v-else-if="item.EN === 'location'" style="display: flex;width:210px">
            <el-input v-model="location" clearable disabled size="mini">
            </el-input>
            <el-button size="mini" type="success" @click="showdialogfun">点我</el-button>
          </div>
          <div v-else-if="item.EN === 'installAddress'" style="display: flex">
            <el-input v-model="installAddress" placeholder="" clearable size="mini">
            </el-input>
          </div>
          <el-input :disabled="item.examineDisabled" v-model="fromModData[item.EN]" placeholder="请输入内容"
            @blur="BurExp($event, item, index)" clearable size="mini" v-else></el-input>
        </span>
        <!-- <span v-if="!item.result" class="font_color">{{item.err}}</span> -->
        <el-tooltip v-if="!item.result" class="item" effect="dark" :content="item.err" placement="top">
          <el-button icon="el-icon-warning" circle></el-button>
        </el-tooltip>
        <span class="inb" v-if="item.type == 'date'">
          <!-- <h1>{{modData.createTime}}</h1> -->
          <el-date-picker :disabled="item.examineDisabled" v-model="fromModData[item.EN]" type="datetime"
            placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" @change="getSTime" style="width: 90%" size="mini">
          </el-date-picker>
        </span>
        <!-- select--------------------------------------- -->
        <!-- {{fromModData}} -->
        <span v-if="item.type == 'select'" class="inb">
          <!-- 字典  typeGroupCode -->
          <!-- {{fromModData}} -->

          <el-select :disabled="item.examineDisabled" v-model="fromModData[item.EN]" placeholder="请选择" size="mini"
            clearable v-if="item.typeGroupCode" @change="changeFromModData">
            <!-- {{fromModData[item.EN]}} -->
            <el-option v-for="i in optionsZi[item.EN]" :key="i.value" :label="i.label" :value="i.value"></el-option>
          </el-select>
          <!-- 字典 dictTable-->
          <el-select :disabled="item.examineDisabled" v-model="fromModData[item.EN]" placeholder="请选择" size="mini"
            clearable v-else-if="item.dictTable">
            <el-option v-for="i in searchOptionTable[item.EN]" :key="i.value" :label="i.label" :value="i.value">
            </el-option>
          </el-select>
          <!-- 小区管理页面   superior -->
          <el-cascader v-else-if="item.EN == 'superior'" v-model="fromModData[item.EN]" :options="superiorListOption"
            :props="{ checkStrictly: true }" size="mini" clearable></el-cascader>
          <!-- 所属组织 -->
          <el-cascader v-else-if="item.EN == 'organization'" v-model="fromModData[item.EN]"
            :options="superiorListOption" :props="{ checkStrictly: true }" size="mini" clearable
            :placeholder="organizationValue"></el-cascader>
          <!-- 租户管理员管理页面---租户 -->
          <el-select :disabled="item.examineDisabled" v-model="fromModData[item.EN]" placeholder="请选择" size="mini"
            clearable v-else-if="item.EN == 'sysCompanyCode'" @change="sysCompanyCodeChange(fromModData[item.EN])">
            <!-- {{fromModData[item.EN]}} -->
            <el-option v-for="i in getFindByTypeData" :key="i.value" :label="i.name" :value="i.sysCompanyCode">
            </el-option>
          </el-select>
          <!-- 租户管理员管理页面---角色 -->
          <el-select :disabled="item.examineDisabled" v-model="fromModData[item.EN]" placeholder="请选择" size="mini"
            clearable v-else-if="item.EN == 'groupId'" @change="sysRoleChange">
            <!-- {{fromModData[item.EN]}} -->
            <el-option v-for="i in roleArr" :key="i.id" :label="i.name" :value="i.id"></el-option>
          </el-select>
          <el-select v-else v-model="fromModData[item.EN]" placeholder="请选择" size="mini" clearable>
            <el-option v-for="i in item.option" :key="i.value" :label="i.label" :value="i.value"></el-option>
          </el-select>
        </span>
        <!-- user -->
        <span v-if="item.type == 'user'">
          <!-- {{useruData}} -->
          <el-select :disabled="item.examineDisabled" v-model="fromModData[item.EN]" placeholder="请选择" size="mini">
            <el-option v-for="i in useruData" :key="i.value" :label="i.name" :value="i.id"></el-option>
          </el-select>
        </span>
        <!-- 单选 -->
        <span v-if="item.type == 'radio'">
          <!-- {{item.radio}} -->
          <div style="margin-top: 20px">
            <el-radio-group v-model="fromModData[item.EN]" size="small">
              <el-radio-button v-for="i in item.radio" :label="i.code" :key="i.code">{{ i.name }}</el-radio-button>
            </el-radio-group>
          </div>
        </span>
        <!-- 计数器 -->
        <span v-if="item.type == 'number'">
          <span style="margin-top: 20px">
            <el-input-number v-model="fromModData[item.EN]" :min="1" label="描述文字" size="mini"></el-input-number>
          </span>
        </span>
        <!-- 上传文件 -->
        <span v-if="item.type == 'file'">
          <el-upload ref="upload" class="upload-demo" action="/api/cb/flInstallApproval/addNewFile" :limit="1"
            :auto-upload="true" :on-success="filesuccess" :on-change="handleFileChange" :before-remove="beforeRemove"
            :file-list="fileList" :on-preview="toPreview">
            <span style="display: flex; justify-content: center">
              <span>
                <el-button size="small" type="primary">点击上传</el-button>
                <!-- <el-button style="margin-left: 10px;" size="small" type="success" @click="uploadfile" >上传到服务器</el-button> -->
                <p style="
                      padding: 0;
                      margin: 0;
                      font-size: 8px;
                      margin-left: 10px;
                    ">
                  只能上传一个文件
                </p>
              </span>
            </span>
          </el-upload>
        </span>
        <!-- 上传图片 -->
        <span v-if="item.type == 'images'">
          <el-upload ref="upload" action="/api/cb/flInstallApproval/addNewFile" list-type="picture-card"
            :file-list="imgList" :auto-upload="false" :on-preview="handlePictureCardPreview" :on-remove="handleRemove"
            :on-change="handleImageChange" :multiple="true" :limit="5">
            <i slot="default" class="el-icon-plus"></i>
            <!-- <div slot="file" slot-scope="{ file }">
              <img class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
            </div> -->
          </el-upload>
          <el-dialog :visible.sync="dialogVisible" append-to-body>
            <img width="100%" :src="dialogImageUrl" alt="" />
          </el-dialog>
        </span>
        <!-- 滑块 -->
        <span v-if="item.type === 'switch'">
          <el-switch v-model="switchvalue" active-color="rgb(11,154,195)" inactive-color="#aaaaaa"
            @change="changeswitch">
          </el-switch>
        </span>
        <!-- 签到点修改 -->
        
      </div>
      <div v-if="xunjianjihuaxinjian" class="inb" style="margin-left: 30px; width: 250px">
          <div style="display: flex; align-items: center; justify-content: center">
            <p style="flex: 2">修改计划路线：</p>
            <el-button type="primary" size="mini" @click="innerVisible = true">点击修改</el-button>
          </div>
          <el-dialog width="70%" :visible.sync="innerVisible" append-to-body title="制定计划路线">
            <xianludituxiugai :selected.sync="innerVisible" @chualaide="chualaide" :qiandaodianshuju="qiandaodianshuju" v-if="innerVisible"></xianludituxiugai>
          </el-dialog>
        </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="modifyData(true, modData)" size="mini">确定</el-button>
        <el-button @click="modifyData(false, modData)" size="mini">取消</el-button>
      </span>
    </el-dialog>
    <el-drawer title="选择安装位置" :visible.sync="showdialog" :direction="direction" :before-close="handleCloselocation"
      :modal-append-to-body="true">
      <div style="margin-left:20px">
        <div>
          <!-- <el-input v-model="mapsearch" size="mini" placeholder="请输入搜索地址" style="width:300px"></el-input> -->
          <el-autocomplete v-model="mapsearch" :fetch-suggestions="querySearchAsync" :trigger-on-focus="false"
            @input="searchlat" @select="handleSelectScenic" placeholder="请选择地址"></el-autocomplete>
          <!-- <el-button @click="searchlat" size="mini">搜索</el-button> -->
        </div>
      </div>
      <div id="map_box" style="width: 600px; height: 600px;margin-top:10px;" v-if="showdialog"></div>
      <div style="margin-left:20px;margin-top:10px;">
        <div>当前选择的经纬度为：{{ lnglatcomputed }}</div>
        <div>当前选择的地点为：{{ address }}</div>
      </div>
      <!-- <Map v-if="showdialog"/> -->
      <div class="allr">
        <el-button @click="confirelatlng" type="success" size="mini">确定</el-button>
        <el-button @click="cancelaltlng" type="success" size="mini">关闭</el-button>
      </div>
    </el-drawer>
    <!-- <el-dialog title="提示" :visible.sync="showdialog" width="30%">
      <span>这是一段信息</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
      </span>
    </el-dialog> -->
  </div>
</template>
<script>
import {
  selectNameByuserId,
  getSelectByCodeAndType, //用于添加租户管理员时选择租户后之间传回选择租户的角色：
} from "@/api/TenantAdministratorManagement";
import {flPatrolPlanPointsearch} from '@/api/xiaofang/base/flPatrolPlan/index';
// import Map from "./map";
import xianludituxiugai from './xianludituxiugai.vue'
// import dictionaries from '@/views/components/FLPage/dictionaries'
export default {
  name: "modificationi",
  components: {
    Map,
    xianludituxiugai,
  },
  props: [
    "modData",
    "attributeOrder",
    "optionsZi",
    "searchOptionTable",
    "TD",
    "UserArr",
    "useruData",
    "getFindByTypeData",
    "superiorListOption",
    'xunjianjihuaxinjian',
  ],
  data() {
    return {
      location: "",
      installAddress: "",
      keyNumb: 0,
      DialogVisibleMods: false,
      dialogVisible: false,
      direction: "rtl",
      // 展示地图遮罩
      showdialog: false,
      //深克隆
      attributeOrderClone: undefined,
      //表单里面的值
      fromModData: undefined,
      // 组件类型
      modelType: "search",
      // 请求到的option
      searchOption: [],
      // 跨表请求option
      searchOptions: [],
      //编辑里面单选
      XTD: undefined,
      //查用户
      // useruData:[],
      // 备注
      textarea: "",
      // 改变的数据
      sysCompanyCodeRoles: "",
      // 租户信息
      // getFindByTypeData:[],
      // 返回的角色对象
      roleArr: [],
      // 返回的角色对象-默认值
      roleArrObj: "",
      switchvalue: false,
      fileList: [],
      innerVisible: false,
      imgList: [],
      //上传文件列表
      annexPath: "",
      //上传图片列表
      imgFiles: [],
      dialogImageUrl: "",
      disabled: false,
      organizationValue: "",
      nowLat: 39.98412, // 纬度
      nowLng: 116.307484, // 经度
      map: null, // 地图对象
      lat: "",
      lng: "",
      location: "",
      address: "",
      markerlist: [],
      mapsearch: "",
      maplist: [],
      timeout: "",
      loading: false,
      zoom: 12,
      center: "",
      qiandaodianshuju:[],
      xianluditudata:null
    };
  },
  watch: {
    optionsZi(newVal) {
      this.searchOption = newVal;
    },
    searchOptionTable(newVal) {
      this.searchOptions = newVal;
    },
    modData(newData) {
      this.getUpdataWatch();
      let vo = this.fromModData.organization.split(",");
      this.deepfor(this.superiorListOption, vo.length, "", vo[vo.length - 1]);

    },
    attributeOrder: {
      deep: true,
      handler(newValue, oldValue) {
        this.attributeOrderClone = JSON.parse(JSON.stringify(newValue));
      },
    },
    mapsearch(newVal) {
      console.log(Object.prototype.toString.call(newVal))
    },
    // showdialog: {
    //   handler (val) {
    //     if (val == true) {
    //       this.center = this.fromModData.location.split(",")
    //       this.center[0] = parseFloat(this.center[0])
    //       this.center[1] = parseFloat(this.center[1])
    //     }
    //   }
    // }
  },
  computed: {
    TableDataModel() {
      let new_DataModel = JSON.parse(JSON.stringify(this.attributeOrder));
      for (let i = 0; i < new_DataModel.length; i++) {
        if (!new_DataModel[i].modificationSign) {
          console.log("-------------计算属性-----------");
          new_DataModel.splice(i, 1);
        }
      }
      return new_DataModel;
    },
    lnglatcomputed: {
      get() {
        return this.lng != "" && this.lng != ""
          ? this.lng + "," + this.lat
          : "点击标记点";
      },
    },
  },
  mounted() {
    [this.attributeOrderClone, this.fromModData, this.XTD] = JSON.parse(
      JSON.stringify([this.attributeOrder, this.modData, this.TD])
    );
    let obj = {};
    if (this.modData.annexPath) {
      obj.url = obj.name = this.modData.annexPath;
      this.fileList = this.fileList.concat(obj);
    }
    let arr = {};
    if (this.modData.imagesPath) {
      arr.url = arr.name = "https://test.fenglankeji.cn" + this.modData.imagesPath;
      this.imgList = this.imgList.concat(arr);
    }
    console.log(this.imgList)
    this.old = this.modData;
    this.imagesPath = this.fromModData.imgFiles;
    this.annexPath = this.fromModData.annexPath;
    this.location = this.fromModData.location;
    this.installAddress = this.fromModData.installAddress;
    let vo = this.fromModData.organization.split(",");
    this.deepfor(this.superiorListOption, vo.length, "", vo[vo.length - 1]);
    this.center = this.fromModData.location.split(",")
    
  },
  methods: {
    chualaide(chualaide) {
      this.xianluditudata = chualaide
      console.log(chualaide, "传过来的值");
    },
    transmit() {
      this.innerVisible = false;
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },
    confirelatlng() {
      this.location = this.lnglatcomputed
      this.installAddress = this.address
      this.showdialog = false;
    },
    cancelaltlng() {
      this.showdialog = false;
      this.location = this.fromModData.location;
      this.installAddress = this.fromModData.installAddress;
      this.address = "";
    },
    showdialogfun() {
      this.showdialog = true;
      setTimeout(() => {
        this.initMap()
      }, 1000)
    },
    setcenter(lng, lat) {
      this.map.setCenter([lng, lat])
    },
    initMap() {
      let centerLng = parseFloat(this.center[0])
      let centerLat = parseFloat(this.center[1])
      this.map = new AMap.Map("map_box", {
        zoom: 11,
        viewMode: "3D", //开启3D视图,默认为关闭
        center: [centerLng, centerLat],
      });
      this.map.on("click", (res) => {
        this.lat = res.lnglat.lat;
        this.lng = res.lnglat.lng;
        this.location = this.lng + "," + this.lat;
        console.log(res);
        this.map.remove(this.markerlist)
        // 根据经纬度获得详细地址

        this.addmarker()

      });
    },
    searchaddress(lng, lat) {
      var geocoder;
      //加载地理编码插件
      this.map.plugin(["AMap.Geocoder"], () => {
        //加载地理编码插件
        geocoder = new AMap.Geocoder({
          radius: 1000, //以已知坐标为中心点，radius为半径，返回范围内兴趣点和道路信息
          extensions: "all", //返回地址描述以及附近兴趣点和道路信息，默认“base”
        });
        //返回地理编码结果
        geocoder.on("complete", (res) => {
          this.address = res.regeocode.formattedAddress;
          console.log(res, "ressss");
        });
        //逆地理编码
        geocoder.getAddress(new AMap.LngLat(lng, lat));
      });
    },
    addmarker(lng, lat) {
      let marker = new AMap.Marker({
        position: new AMap.LngLat(lng, lat),
        icon: "https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
        anchor: "bottom-center",
        zIndex: 1,
      });
      // this.markerlist.push(marker);
      this.map.add(marker);
      AMap.Event.addListener(marker, "click", (res) => {
        console.log(res, "clickmarkerevent")
        let [lng, lat] = [res.lnglat.lng, res.lnglat.lat]
        this.searchaddress(lng, lat)
        this.location = lng + "," + lat;
        this.lng = lng;
        this.lat = lat;
        console.log(this.location)
      })
    },
    inputsearch() {
      if (this.mapsearch !== []) {
        console.log(this.mapsearch)
        this.searchlat()
      }
    },

    querySearchAsync(queryString, cd) {
      let arr = []
      this.maplist.forEach(item => {
        let obj = {
          value: item.address + item.name,
          la: item.location.lng + "," + item.location.lat,
          id: item.id,
          lat: item.location.lat,
          lng: item.location.lng
        }
        arr.push(obj)
      });
      console.log(arr)
      this.timeout = setTimeout(() => {
        console.log(this.maplist)
        // 调用组件自定方法展示搜索结果
        cd(arr);
      }, 2000 * Math.random());
    },

    handleSelectScenic(item) {
      // item是点击选中的一项
      console.log("item==>", item);
      [this.lng, this.lat, this.address, this.location] = [item.lng, item.lat, item.value, item.la]

      this.setcenter(this.lng, this.lat)
      this.maplist.forEach(item => {
        console.log(item)
        this.addmarker(item.location.lng, item.location.lat)
      });
      this.map.zoom = 8
    },

    // 地图初始化函数，本例取名为init，开发者可根据实际情况定义
    searchlat() {
      console.log("我执行了")
      this.map.plugin('AMap.PlaceSearch', () => {
        let PlaceSearchOptions = { //设置PlaceSearch属性
          city: "全国", //城市
          type: "", //数据类别
          pageSize: 10, //每页结果数,默认10
          pageIndex: 1, //请求页码，默认1
          extensions: "base" //返回信息详略，默认为base（基本信息）
        };
        var MSearch = new AMap.PlaceSearch(PlaceSearchOptions); //构造PlaceSearch类
        console.log(AMap, "amap")
        AMap.Event.addListener(MSearch, "complete", (res) => {
          console.log(res, "我是地图返回值")
          this.maplist = res.poiList.pois
          console.log(this.maplist)

        }); //返回结果
        MSearch.search(this.mapsearch); //关键字查询
      });
    },
    handleCloselocation(done) {
      this.$confirm("确认关闭？")
        .then((_) => {
          done();
        })
        .catch((_) => { });
    },
    toPreview() {
      console.log(this.annexPath)
      window.open("https://test.fenglankeji.cn" + this.annexPath);
      // debugger;
    },
    changeFromModData() {
      // this.changeDictionariesType(this.fromModData);
    },
    // 监听遍历
    deepfor(data, depth, ptit, length) {
      for (let v of data) {
        if (v.value.includes(length)) {
          this.organizationValue = v.label;
        }
        if (v.hasOwnProperty("children") && v.children.length) {
          this.deepfor(v.children, depth + 1, v.label, length);
        }
      }
    },
    // 上传文件执行
    handleFileChange(file) {
      this.annexPath = file.raw;
    },
    handleImageChange(file) {
      console.log(this.imgFiles)
      debugger;
      this.imgFiles.push(file.raw);
      console.log(this.imgFiles)
      debugger;
    },
    filesuccess(file) {
      console.log(file);
      this.annexPath = file.data;
    },
    imagesuccess(file) {
      // console.log(file);
      this.imgFiles = file.data;
    },
    handleRemove(file) {
      console.log(this.$refs, "//////////////");
      this.$refs.upload[1].handleRemove(file);
    },
    beforeRemove(file, fileList) {
      return this.$confirm(`确定移除 ${file.name}？`);
    },
    changeswitch(value) {
      this.switchvalue = value;
    },
    // 字典值的类型转换
    changeDictionariesType(fromModData) {
      // console.log(fromModData,'改变之前');
      for (const key in fromModData) {
        if (fromModData.hasOwnProperty(key)) {
          const element = fromModData[key];
          let elements;
          if (element) {
            elements = String(element);
          }
          fromModData[key] = elements;
        }
      }
      // console.log(fromModData,'改变之后');
    },
    modificationiClick() {
      console.log(this.fromModData, "shishenme");
      console.log(this.modData.id,'dssssssssssssssssssssss');
      flPatrolPlanPointsearch({planId:this.modData.id}).then(item=>{
        this.qiandaodianshuju=item.data
        this.qiandaodianshuju['routePoints']=this.fromModData.routePoints
        console.log(item);
      })
      // this.changeDictionariesType(this.fromModData)
      // this.keyNumb = this.keyNumb + 1
      // 打开窗口
      this.DialogVisibleMods = true;
      // this.$emit('modificationiClickData','点击修改')
      // 获取角色原始数据
      this.getSelectNameByuserIds();
    },
    // 添加
    // addRoleModel(){
    //   roleId
    // },
    // 获取角色原始数据
    async getSelectNameByuserIds() {
      // console.log(1,'ccccccccccccccc');
      // console.log(this.fromModData);
      // let fromModData = undefined
      // this.$nextTick(function(){
      // fromModData = this.fromModData
      // })
      // 赋值
      console.log(this.modData, "999");
      if (this.modData.isGis == 0) {
        this.switchvalue = false;
      } else {
        this.switchvalue = true;
      }

      const sysCompanyCode = this.modData.sysCompanyCode;
      const id = this.modData.id;

      if (this.modData.sysCompanyCode) {
        // let sysCompanyCode = undefined
        // const sysCompanyCode = this.fromModData.sysCompanyCode
        // this.$nextTick(function(){
        //   sysCompanyCode = this.modData.sysCompanyCode
        // })
        // console.log(this.$parent.$parent.$parent,'youme');
        // console.log(sysCompanyCode,'???');
        const res = await selectNameByuserId(id);
        // const res = this.$parent.$parent.$parent.getSelectNameByuserId(id)
        // 如何将   ----转换格式？？？
        console.log(res, 999922222);
        const objRole = res.data;
        if (objRole) {
          this.modData.groupId = objRole.id;
          this.roleArr = [objRole];
        }
        // 转换后拿到的数据
        // 赋值
        // this.modData.groupId = res.data
        // this.roleArr = 返回的数据
      }
    },
    // 角色
    sysRoleChange(newvalue) {
      // this.$emit('sysRoleChangeData',newvalue)
      const roleArrs = this.roleArr;
      var id = "";
      for (let index = 0; index < roleArrs.length; index++) {
        const element = roleArrs[index];
        id = roleArrs[index].id;
      }
      this.$emit("sysRoleIdq", id);
      console.log(id, "????");
    },
    // 租户改变函数
    async sysCompanyCodeChange(value) {
      const res = await getSelectByCodeAndType(value);
      console.log(
        res,
        "子组件用于添加租户管理员时选择租户后之间传回选择租户的角色"
      );
      const roleObjs = res.data;
      if (roleObjs) {
        this.roleArr = roleObjs;
      } else {
        console.log("该租户没有对应的角色");
      }
    },
    // 更新数据
    getUpdataWatch() {
      [this.attributeOrderClone, this.fromModData, this.XTD] = JSON.parse(
        JSON.stringify([this.attributeOrder, this.modData, this.TD])
      );
      // this.changeDictionariesType(this.fromModData)
    },
    // 字典回调
    // dictionariesCallBack(res){
    //   // console.log(res,'zicisyiihsjkdjsa');
    //   // this.$nextTick(function(){
    //   //   this.searchOption = res
    //   // })
    //   this.searchOption = res
    //   // console.log(this.searchOption,'ceshiyixia');

    // },
    // 跨表字典回调
    // dictionariesTableCallBack(res){
    //   // console.log(res,'zicisyiihsjkdjsa');
    //   // this.$nextTick(function(){
    //   //   this.searchOption = res
    //   // })
    //   this.searchOptionTable = res
    //   // console.log(this.searchOption,'ceshiyixia');

    // },
    handleCloses(done) {
      this.$confirm("确认关闭？")
        .then((_) => {
          this.modifyData(false, this.modData, this.annexPath, this.imgFiles);
          done();
        })
        .catch((_) => { });
    },
    //转化时间格式
    getSTime(val) {
      this.modData.createTime = val;
    },
    //确定修改-取消修改
    modifyData(value, modData) {
      // this.changeDictionariesType(this.fromModData)
      //value=true  确定修改
      //value=false  取消修改
      // console.log(value,modData)
      let bur = true;
      if (value === false) {
        this.fromModData = this.old;
        this.$emit("modifyData", false, this.fromModData);
        this.DialogVisibleMods = false;
        console.log(this.fromModData, "zheshishenem");

        // this.$message({
        //   message: "已取消修改",
        //   type: "success"
        // });
      } else {
        console.log(this.attributeOrderClone, "shenme?");
        for (let i = 0; i < this.attributeOrderClone.length; i++) {
          this.attributeOrderClone[i].value =
            this.fromModData[this.attributeOrderClone[i].EN];
          let at = this.attributeOrderClone[i];
          console.log(at, "at");

          if (at.modificationSign && !at["skipSign"]) {
            if (
              at.result === false ||
              at.value === "" ||
              at.value === undefined
            ) {
              // 判断红色星号    是否必须为空
              bur = false;
              break;
            }
          } else {
            if (at.result === false) {
              bur = false;
              break;
            }
          }
        }
        if (this.switchvalue === false) {
          this.fromModData.gisStatus = 0;
        } else {
          this.fromModData.gisStatus = 1;
        }
        console.log(this.fromModData.organization, '2222');

        // this.fromModData.organization = this.fromModData.organization.join(",");
        // console.log(this.fromModData.organization);
        this.fromModData.annexPath = this.annexPath;
        this.fromModData.imagesPath = this.imgFiles;
        console.log(this.fromModData, "999999999999");
        if (bur === true && value === true) {
          console.log(this.fromModData, "*************");
          console.log(value, "*************");
          var obj={...this.fromModData,...this.xianluditudata}
          this.$emit("modifyData", value, obj);
          this.DialogVisibleMods = false;
        } else if (bur === false && value === true) {
          this.$message({
            message: "请输入合法内容！",
            type: "warning",
          });
        }
      }
    },

    //正则表达式
    BurExp(e, item, index) {
      // if (this.attributeOrderClone[index].attributeOrderClone) {
      if (this.attributeOrderClone[index].skipSign && e.target.value === "") {
        item.result = true;
      } else {
        let boolean = new RegExp(item.Exp).test(e.target.value);
        item.result = boolean;
      }
    },
  },
  created() {
    // this.getSelectNameByuserIds()
    // let vo = this.fromModData.organization.split(",");
    // this.deepfor(this.superiorListOption, vo.length, "", vo[vo.length - 1]);
  },
};
</script>
<style scoped src="src/styles/allCss.css">

</style>
<style lang="scss" scoped>
.sll {
  /deep/.is-circle {
    padding: 14px !important;
  }

  .el-dialog__wrapper {
    /deep/.dialog {
      width: 760px;
      // padding-right: 20px;
    }
  }

  // /deep/.el-dialog{
  //   .el-dialog__header{
  //   width: 780px;
  //   }
  //   .el-dialog__body{
  //   width: 780px;
  //   }
  // }
  /deep/.el-dialog__body {
    display: flex;
    flex-wrap: wrap;
  }

  .list {

    // height: 44px;
    // width: 370px;
    // width: 320px;
    // margin-left: 20px;
    // height: 44px;
    // width: 300px;
    // .inb{
    //   height: 44px;
    //   width: 370px;
    // }
    // margin: 0;
    // padding: 0;
    .fon {
      text-align: right;
      margin-right: 14px;
      width: 99px;

      .inb {
        height: 44px;
        width: 370px;

        .el-input {
          /deep/.el-input__inner {
            width: 210px;
            height: 30px;
          }
        }

        .el-select {
          /deep/.el-input__inner {
            width: 210px;
            height: 30px;
          }
        }

        .el-textarea {
          /deep/.el-textarea__inner {
            width: 210px;
            height: 60px;
          }
        }
      }
    }

    .is-circle {
      margin-left: 3px;
      padding: 0 !important;
      color: #e69620;
      border: 0;

      /deep/.el-icon-warning {
        height: 14px;
        width: 14px;
      }
    }

    .el-button--mini {
      padding: 7px 5px;
      width: 40px;
    }
  }
}
</style>


